<?php echo $this->render("header.phtml"); ?>
<label class="title">Member control - Update profile</label>
<div class="horiz_sep">&nbsp;</div>
<?php 
	$account = (object) $this->account;
	$utilities = $this->utilities;
	if (isset($this->errors)){
		$errors = $this->errors;		
		if (key_exists("fullname_null", $errors)) $fullname_null = $errors['fullname_null'];
		if (key_exists("email_incorrect", $errors)) $email_incorrect = $errors['email_incorrect'];
	}
?>
<form action="<? echo $this -> baseUrl ?>/<?= $this->contextPath ?>/update" method="post">
<table cellpadding="0" cellspacing="5" width="100%" border="0">
  	<tr>  	
    	<th width="20%">Account/Mobile:</th>
    	<td><b><?php echo $account->usr_mobile; ?></b></td>
  	</tr>
  	<tr>
    	<th>Name:</th>
    	<td>
    		<input maxlength="50" type="text" name="usr_fullname" value="<?php echo $account->usr_fullname; ?>" style="padding:2px;" /> <font color="red" style="font-weight:bold;">*</font>
    		<?php if (isset($fullname_null)){ ?>
				<span style="color:red; font-weight:bold;"><?php echo $fullname_null; ?></span>
			<?php } ?>
    	</td>
  	</tr>
  	<tr>
    	<th>Birthday:</th>
    	<td>
			<table cellpadding="0" cellspacing="0">
			<?php 
				$birthday = split("-", $account->usr_birthday);
				$day = (int) $birthday[2];
				$month = (int) $birthday[1];
				$year = (int) $birthday[0];
			?>
				<tr>
					<td style="padding-right:5px;">
						<select name="day">
							<option value="0"/>Ngày
							<?
							for ($i=1; $i<=31; $i++){
								if ($i==$day){
									echo '<option value="'.$i.'" selected/>'.$i;
								} else {
									echo '<option value="'.$i.'"/>'.$i;
								}
							}
							?>
						</select>
					</td>
					<td style="padding-right:5px;">
						<select name="month">
							<option value="0"/>Tháng
							<?
							for ($i=1; $i<=12; $i++){
								if ($i==$month){
									echo '<option value="'.$i.'" selected/>'.$i;
								} else {
									echo '<option value="'.$i.'"/>'.$i;
								}								
							}
							?>
						</select>
					</td>
					<td>
						<select name="year">
							<option value="0"/>Năm
							<?
							$year1 = date('Y');
							for ($i=$year1-10; $i>=$year1-70; $i--){
								if ($i==$year){
									echo '<option value="'.$i.'" selected/>'.$i;
								} else {
									echo '<option value="'.$i.'"/>'.$i;
								}								
							}
							?>
						</select>
					</td>
				</tr>
			</table>
		</td>
    	<!-- <td><input maxlength="10" type="text" name="usr_birthday" value="<?php echo $utilities->formatdate($account->usr_birthday); ?>" style="padding:2px;" /></td> -->
  	</tr>
  	<tr>
    	<th>Email:</th>
    	<td>
    		<input maxlength="100" type="text" name="usr_email" value="<?php echo $account->usr_email; ?>" style="padding:2px;" />
    		<?php if (isset($email_incorrect)){ ?>
				<span style="color:red; font-weight:bold;"><?php echo $email_incorrect; ?></span>
			<?php } ?>
			(ex: example@gmail.com)
    	</td>
  	</tr>
  	<tr>
    	<th />
    	<td><input type="submit" name="save" value="Save" /></td>
  	</tr>
</table>
</form>
<?php echo $this->render("footer.phtml"); ?>